Stump the Panel: SharePoint Q&A

Immediate solutions for common SharePoint questions
Last visit was: Sun Oct 10, 2010 6:01 am It is currently Sun Oct 10, 2010 6:01 am

All times are UTC




 [ 9 posts ] 
Author Message
 Post subject: Dynamic Dropdown Menu
PostPosted: Wed May 26, 2010 9:00 pm 
Offline

Joined: Wed May 26, 2010 8:55 pm
Posts: 2
I have a need to dynamically add an option to a drop down menu based on the user that is logged in. So far I've been able to add the option based on the user, to add the option to the drop down menu I'm using something similar to the following:

$('<option value="Midwest">Midwest</option>').appendTo('select[title="Test"]');

However, when the user clicks OK to submit the new list item SharePoint gives an 'an unexpected error occured'.

Is doing something like this even possible?

Thanks!


Top
  
 
 Post subject: Re: Dynamic Dropdown Menu
PostPosted: Wed May 26, 2010 9:43 pm 
Offline
User avatar

Joined: Sat Jan 02, 2010 8:29 pm
Posts: 366
Location: Boston, MA, USA
Just adding the value into the DOM won't make it a valid value. You'll need to use the Web Services to add the value to the column itself, and then refresh the dropdown with the right ID value for the control to work.

M.

_________________
Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog


Top
  
 
 Post subject: Re: Dynamic Dropdown Menu
PostPosted: Wed Jul 21, 2010 8:27 pm 
Offline

Joined: Wed Jul 21, 2010 8:16 pm
Posts: 2
Hello Marc.
Than you for the solution that you have provided for the cascading dropdown. I have some trouble working with it:can you please guide me where I am going wrong. I follwoed the follwoing steps:
1. Created a list called cities
2. Created another list called countries
3.Created a list called Vacation Plans- which has colums Country(look up from countries list) and City ( choice field, with column - no city selected)
4. Then I created a new item and added a content editor web part ( By default i was not able to edit the newitem.aspx page from browser- so when I opened the page I said http:/mysite/lists/newitem.aspx?toolpaneview=2 - which allowed me to add the content editor webpart).
5.After that I put the follwoing code in the source editor
<script language="javascript" type="text/javascript" src="http://moss.litwareinc.com/Cascade/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="http://moss.litwareinc.com/Cascade/jquery.SPServices-0.5.6.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$().SPServices.SPCascadeDropdowns({
relationshipList: "Cities",
relationshipListParentColumn: "Country",
relationshipListChildColumn: "Title",
parentColumn: "Country",
childColumn: "City"'
debug: true

});

});
</script>
When i hit on Ok it saves teh code. when I go back to teh new page and say new item, and select a county say United states- i get the options under that which is absoultely firn, bt when i hit on ok to save it I get the error -
"An unexpected error has occurred.
Troubleshoot issues with Windows SharePoint Services. "

I do not understand the issue here. I am kind of new bie to sharepoint. Can you please help me out with this?

Thank you very much.


Top
  
 
 Post subject: Re: Dynamic Dropdown Menu
PostPosted: Fri Jul 23, 2010 2:24 am 
Offline
User avatar

Joined: Sat Jan 02, 2010 8:29 pm
Posts: 366
Location: Boston, MA, USA
The City column needs to be a Lookup column into the Cities list. The Cities list also needs to contain the relationships between the City and Country. Hopefully it's a simple as that.

M.

_________________
Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog


Top
  
 
 Post subject: WSS 3.0 Room Booking Template
PostPosted: Fri Jul 23, 2010 6:55 am 
Offline

Joined: Fri Jul 16, 2010 12:54 pm
Posts: 33
Hi Marc,

Sorry to post in this thread... no one is replying so thought to post here

I am using wss 3.0 Room and Equipment bookings Template provided by Microsoft.

If u see the template under Reservations/Availability.aspx a diagramatic or Grid view is displayed with the resources in a column and time durations for the resources in different columns.

When we book a resource a purple color image is displayed to the corresponding Resource and the time.

My Requirement: want to show a tool tip or display text on the colored zone(purple color) or reserved zone as "Reserved By: @user" that who has actually reserved that.

As soon as i try to display some thing title={@author} or title={@Reserved by}.....the tool tip shows the user that has created a "Resource" but not who has actually "Reserved" or the user who created item under "Reservations" List

Please help me on this.

Thanks in advance

_________________
..Jam..


Top
  
 
 Post subject: Re: Dynamic Dropdown Menu
PostPosted: Fri Jul 23, 2010 11:37 am 
Offline
User avatar

Joined: Sat Jan 02, 2010 8:29 pm
Posts: 366
Location: Boston, MA, USA
Jam:

This one may be as simple as your spelling of the column name(s).
title={@author} -> Should be -> title={@Author}
title={@Reserved by} -> Should *probably* be -> title={@Reserved_x0020_by}

Unfortunately, that will add the full HTML blob about the user to the tooltip. You actually need to parse out the person's name from the blob. See the GetUserName in my SPXSLT Codeplex Project.

M.

_________________
Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog


Top
  
 
 Post subject: Re: Dynamic Dropdown Menu
PostPosted: Fri Jul 23, 2010 12:21 pm 
Offline
User avatar

Joined: Mon Jan 04, 2010 5:15 am
Posts: 972
Location: North Carolina
Reserved By is just the Created By column renamed, so it should be @Author.

Please dont hijack threads as it makes for finding solutions for others difficult.

_________________
eric
twitter.com/PirateEric


Top
  
 
 Post subject: Re: Dynamic Dropdown Menu
PostPosted: Fri Jul 23, 2010 12:33 pm 
Offline

Joined: Fri Jul 16, 2010 12:54 pm
Posts: 33
Thanks for the reply Marc/Eric
Im sorry again for breaking the thread

yeah i understand that i need to give something like title="{@Author}" or title="{@Reserved_x0020_by}" but in tooltip it is showing the author of the Resource but not the Reservation..... u will get to know once u see the template of Room and Equipment Reservations template.....

Thanks for your support

_________________
..Jam..


Top
  
 
 Post subject: Re: Dynamic Dropdown Menu
PostPosted: Fri Jul 23, 2010 7:12 pm 
Offline

Joined: Wed Jul 21, 2010 8:16 pm
Posts: 2
Thanks Marc - for you Support. Its working now.


Top
  
 
 [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: Alexa [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group